package com.imay.live.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.R;
import com.imay.live.helper.LevelHelper;
import com.imay.live.proto.user.UserInfoCard;
import com.imay.live.utils.GlideUtil;

import java.util.List;

/**
 * Created by jeaman on 2017/4/18.
 */

public class RoomAdminAdapter extends BaseQuickAdapter<UserInfoCard, BaseViewHolder> {

    public RoomAdminAdapter(List<UserInfoCard> data) {
        super(R.layout.item_room_admin, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UserInfoCard item) {
        helper.setBackgroundRes(R.id.room_admin_tv_user_level, LevelHelper.getUserLevelResId(item.UserLv));
        helper.setText(R.id.room_admin_tv_user_level, String.valueOf(item.UserLv));
        helper.setText(R.id.room_admin_tv_nick, item.nick);
        helper.setText(R.id.room_admin_tv_room_id, mContext.getString(R.string.live_room_roomid,item.roomId));
        helper.addOnClickListener(R.id.room_admin_tv_delete);
        int vipRes = LevelHelper.getVIPSmallIcon(item.OfficialVip, item.LargeVipStatus);
        helper.setImageResource(R.id.room_admin_iv_level, vipRes);
        GlideUtil.loadCircleBorderImage((ImageView) helper.getView(R.id.room_admin_iv_avatar), item.imgHead, R.dimen.border_avatar, R.color.line_ff, R.mipmap.pnl_00_head108);
    }
}
